package com.stox.client.ui.javafx.chartingy.persistence.chart.dto;

import java.util.ArrayList;
import java.util.List;

import com.stox.client.ui.javafx.chartingy.model.chart.PrimaryChart;
import com.stox.client.ui.javafx.chartingy.model.plot.IndicatorPlot;
import com.stox.client.ui.javafx.chartingy.model.plot.Plot;
import com.stox.client.ui.javafx.chartingy.model.plot.PricePlot;

public class PrimaryChartDTO extends ChartDTO<PricePlotDTO> {
	private static final long serialVersionUID = 1L;
	
	private List<IndicatorPlotDTO> indicatorPlots = new ArrayList<>();
	
	public PrimaryChartDTO() {
		
	}
	
	public PrimaryChartDTO(PrimaryChart chart) {
		super(chart);
		setPrimaryPlot(new PricePlotDTO(chart.getPrimaryPlot()));
		for(Plot<?,?> plot : chart.getPlots()){
			if(plot instanceof PricePlot){
				getPlots().add(new PricePlotDTO((PricePlot)plot));
			}
			if(plot instanceof IndicatorPlot){
				indicatorPlots.add(new IndicatorPlotDTO((IndicatorPlot<?,?>)plot));
			}
		}
	}
	
	public List<IndicatorPlotDTO> getIndicatorPlots() {
		return indicatorPlots;
	}
	
	public void setIndicatorPlots(List<IndicatorPlotDTO> indicatorPlots) {
		this.indicatorPlots = indicatorPlots;
	}

}
